#ifndef GAMECONTROL_H
#define GAMECONTROL_H

#include <QObject>
#include "robot.h"
#include "userplayer.h"
#include "cards.h"

class GameControl : public QObject
{
    Q_OBJECT
public:
    explicit GameControl(QObject *parent = nullptr);

    //游戏状态
    enum GameStatus
    {
        DispatchCard, //发牌
        CallingLord,  //抢地主
        PlayingHand   //出牌
    };

    //玩家状态
    enum PlayerStatus
    {
        ThinkingForCallLord, //考虑抢地主
        ThinkingForPlayHand, //考虑出牌
        Winning              //胜利
    };

    //初始化玩家
    void Player_Init();

    //得到玩家实例
    Robot* Get_Left_Robot();
    Robot* Get_Right_Robot();
    UserPlayer* Get_User_Player();

    //当前玩家对象是变化的
    void Set_Current_Player(Player* player);
    Player* Get_Current_Player();

    //得到出牌玩家和打出的牌
    Player* Get_Pend_Player();
    const Cards& Get_Pend_Cards()const;

    //初始化扑克牌
    void Init_All_Cards();
    //每次发一张牌
    Card Take_One_Card();
    //得到三张底牌
    Cards Get_Surplus_Cards();
    //重置卡牌
    void Reset_Cards_Data();

    //准备叫地主
    void Start_Lord_Card();
    //成为地主
    void Become_Lord(Player* player);
    //清空所有玩家分数
    void Clear_Player_Score();

    //处理叫地主
    //处理出牌

signals:

private:
    Robot* robot_left_;
    Robot* robot_right_;
    UserPlayer* user_;
    Player* current_player_;
    Player* pend_player_;
    Cards pend_cards_;
    Cards all_cards_;
};

#endif // GAMECONTROL_H
